#ifndef __COLOR_H
#define __COLOR_H

#include <vector>
#include <opencv2/opencv.hpp>
#include "Bin.h"
#include "Palette.h"
#include "commondef.h"
using namespace std;
using namespace cv;

class Palette;
///////////////////////////////////////
void TransferColor(const Mat &inputimg, Mat &outputimg, const Palette & palette);

ColorL TransferLuminance(ColorL L,const vector<ColorL> &L_origin,const vector<ColorL> &L_change);

ColorLab TransferAB(const ColorLab &input,const ColorLab &edited, ColorL L,const ColorLab &x);

///////////////////////////////////////
float LabDistance2(const ColorLab &a, const ColorLab &b);

ColorRGB Lab2RGB(const ColorLab& inputColor);

ColorRGBf Lab2RGBf(const ColorLab& inputColor);

ColorLab LabFindBoundary(const ColorLab &p1,const ColorLab &p2);

ColorLab LabBoundary(const ColorLab& pin, const ColorLab& pout);

bool isOutGamut(const ColorLab &a);

ColorLab RGB2Lab(int R, int G, int B);

void LabSort(ColorLabList &colors);

ColorLab LabSub(const ColorLab &a, const ColorLab &b);

ColorLab LabAdd(const ColorLab &a, const ColorLab &b);

ColorLab Weight_Mul(const ColorLab &lab,float Weight);

float Omega(const ColorLabList &origin, const ColorLab &Lab, int i, const Mat & Lambda, float sigma);
float Phi(float r, float sigma);
ColorLab LabNorm(const ColorLab &a);
#endif  // __COLOR_H
